const App = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    options: {},
    isRegister:true,
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options){
    let _this = this;
    options.agentid = wx.getStorageSync('agentid');
    options.referee_id = wx.getStorageSync('referee_id');
    _this.setData({
      options
    });    
  },
  onShow(){
    this.setData({
      isRegister:wx.getStorageSync('isRegister')
    });
  },
 /**
   * 提交
   */
  onsumbit(e) {
    if(e.detail.value.number==""){
      return;
    }
    let _this = this;
    App._post_form('user.index/claim', {number:e.detail.value.number}, result => {
      wx.setStorageSync('teamId', result.data.team_id);
      // _this.onNavigateBack(1);
       wx.switchTab({
         url: '/pages/user/index',
       })
    });
  },
  getUserInfo(e){
    // let _this = this;
    // console.log(e);
    // App.getUserInfo(e.detail, (follow) => {
    //   _this.onNavigateBack(1);
    // });
  },

  

  /**
   * 授权成功 跳转回原页面
   */
  onNavigateBack(delta) {
    wx.navigateBack({
      delta: Number(delta || 1)
    });
  },


})